package com.rmv.ums.condition;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;

public class MethodCondition extends AbstractCondition {

	private static final Logger logger = Logger.getLogger(MethodCondition.class);

	public boolean check(HttpServletRequest request) {
		String method = request.getMethod();
		boolean ok = method.equalsIgnoreCase(this.getValue());
		
		if (logger.isDebugEnabled()) {
			if(ok) {
				logger.debug("request fulfill condition:" + this);
			} else {
				logger.debug("request doesn't fulfill condition:" + this);
			}
		}
		return ok;
	}

}
